
<%@ page import="com.surelution.projects.crm.OwnStation" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'ownStation.label', default: 'OwnStation')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="stationImport"><g:message code="default.ownStationImport.label" args="[entityName]" /></g:link></span>
		    <span class="menuButton"><g:link class="export" action="export">${message(code: 'default.button.export.label', default: 'Export')}</g:link></span>
        </div>    
				
        <div class="body">
            <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                            <g:sortableColumn property="stationArea" title="${message(code: 'ownStation.stationArea.label', default: 'stationArea')}" />
                        
                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.name.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.code.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.manager.label"/></th>
                            
                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.managerTel.label"/></th>                         

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.level.label"/></th>
                        
                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.star.label"/></th>

                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.tonLevel.label"/></th>
                        
                            <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="ownStation.address.label"/></th>
                            
	                        <th style="color:white;font-size:12px;font-weight:bold;"><g:message code="market.isLocked.label"/></th>
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${ownStationInstanceList}" status="i" var="ownStationInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                            <td>${fieldValue(bean: ownStationInstance, field: "stationArea.areaName")}</td>
                        
                            <td><g:link action="show" id="${ownStationInstance.id}">${ownStationInstance.shortName}</g:link></td>

                            <td>${fieldValue(bean: ownStationInstance, field: "code")}</td>

                            <td>${fieldValue(bean: ownStationInstance, field: "manager")}</td>

                            <td>${fieldValue(bean: ownStationInstance, field: "managerTel")}</td>

                            <td>
							   	<g:if test="${ownStationInstance.level.title.size()>3}"><label title="${ownStationInstance.level.title}">${ownStationInstance.level.title.substring(0,3)}</label> </g:if>
                            	<g:if test="${ownStationInstance.level.title.size()<3}"><label title="${ownStationInstance.level.title}">${ownStationInstance.level.title}</label></g:if>
                            </td>

                            <td>${fieldValue(bean: ownStationInstance, field: "star.title")}</td>

                            <td>${fieldValue(bean: ownStationInstance, field: "tonLevel.title")}</td>

							<td>
                            	<richui:teaser length="10" value=" ${ownStationInstance.address}"/>
                            </td>
                            
                            <td><g:formatBoolean boolean="${ownStationInstance.isLocked}" /></td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${ownStationInstanceTotal}" />
            </div>
        </div>
    </body>
</html>
